package jgl.vajra.management.part.mine.model;

import java.util.Map;

import io.reactivex.Observable;
import jgl.vajra.management.bean.CarDetailsBean;
import jgl.vajra.management.manager.AccountManager;
import jgl.vajra.management.part.mine.contract.CarDetailsContract;
import jgl.vajra.management.widget.manager.RxJavaHttpManager;
import jgl.vajra.management.widget.manager.retrofit.RetrofitJsonManager;
import jgl.vajra.management.widget.utils.UIUtils;

public class CarDetailsModel extends CarDetailsContract.Model{
    @Override
    public Observable<CarDetailsBean> getCarDetailsData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().getCarDetailsData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<Object> deleteCarData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().deleteCarData(map)
                .compose(RxJavaHttpManager.applyTransformer());
    }

    @Override
    public Observable<String> modifyCarData(Map<String, Object> map) {
        return RetrofitJsonManager.getInstance().getApiService().modifyCarData(map, AccountManager.getInstance().getLoginData(UIUtils.getContext()).authorization)
                .compose(RxJavaHttpManager.applyTransformer());
    }
}
